<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机点名</title>
    <style>
        .box {
            width: 300px;
            margin: 10px auto;
            font-size: 20px;
            text-align: center;
        }
        .btns {
            margin-top: 20px;
        }
        .btns button {
            padding: 5px 10px;
        }
    </style>
</head>
<body>
    <div class="box">
        <div>中奖名单：<span class="win-name">温英杰</span></div>
        <div class="btns">
            <button class="start-btn">开始抽奖</button>
        </div>
    </div>
    <script>
        let arr = [
            "马达","姚皓炫","邹卓伦","杨颂业","陆健峰","王国鸣","王正杰",
            "温英杰","张露文","王靖哲","邱广南","陈澍(shù)骏",
            "齐国强","肖懿(yì)豪","吴健科","傅培钦","杨文斌","谢锦杨","钱嘉俊","丘德坤",
            "李烨(yè)垚(yáo)","胡洪伟","巫绍东","王浚霖","潘卫阳","杨嘉诚","黎尚德",
            "肖慧灵","韦宏鹰","利慧纬","黄诗淇","谢凤","陆诗韵",
            "李斌彬","韦发达","汪宇卓","杨智源","谭永升","朱健彬","蒋俊峰","蒋子恒"
        ]
        // 随机生成一个下标值
        let winName = document.querySelector(".win-name")
        function start(){
            let count = 0
            let timer = setInterval(()=>{
                count++;
                let index = getRandom(0, arr.length)
                winName.innerHTML = arr[index]
                if(count >= arr.length){
                    clearInterval(timer)
                }
            },100)
        }
        // 开始抽奖
        document.querySelector(".start-btn").addEventListener("click", ()=>{
            start()
        })
        // 随机数据 min-max范围，不包含max
        function getRandom(min,max){
            return Math.floor(Math.random()*(max-min)+min)
        }

    </script>
</body>
</html>